package com.jm.task.scheduled;

import com.jm.common.rabbitmq.constant.MqConst;
import com.jm.common.rabbitmq.service.RabbitService;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@EnableScheduling
public class ScheduledTask {
    @Resource
    private RabbitService rabbitService;

    //每天8点执行方法，就医提醒
    //cron表达式，设置执行间隔
    //正规每日8h：0 0 8 * * ?
    //测试每隔30s：30 * * * * ?
    @Scheduled(cron = "0 0 8 * * ?")
    public void taskPatient(){
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }

}
